﻿@model BugTracker.ViewModels.UsersViewModel

@{
    ViewBag.Title = "Create";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@section scripts
{
    <script src="@Url.Content("~/Scripts/local-scripts/users-scripts.js")" type="text/javascript"></script>
}

@*@using (Html.BeginForm("Create", "Users", FormMethod.Post, new { id = "form1", @class = "small-forms" }))*@
@using (Ajax.BeginForm("Create",null,new AjaxOptions(){ UpdateTargetId="form1" }, new { id = "form1", @class = "small-forms" }))
{    
    <fieldset>
        <legend>User Registration</legend>
        <div class="form-row">
            <div class="col1">@Html.LabelFor(m => m.Users.Username)</div>
            <div class="col2">@Html.TextBoxFor(m => m.Users.Username, new { @class = "textbox" })</div>
            @Html.ValidationMessageFor(m => m.Users.Username)
        </div>
        <div class="form-row">
            <div class="col1">@Html.LabelFor(m => m.Users.Password)</div>
            <div class="col2">@Html.PasswordFor(m => m.Users.Password, new { @class = "textbox" })</div>
            @Html.ValidationMessageFor(m => m.Users.Password)
        </div>
        <div class="form-row">
            <div class="col1">@Html.LabelFor(m => m.Users.Email)</div>
            <div class="col2">@Html.TextBoxFor(m => m.Users.Email, new { @class = "textbox" })</div>
            @Html.ValidationMessageFor(m => m.Users.Email)
        </div>
        <div class="form-row">
            <div class="col1">@Html.LabelFor(m => m.Users.UserTypeID)</div>
            <div class="col2">
                @Html.DropDownListFor(m => m.Users.UserTypeID, new SelectList(Model.UserTypes, "Value", "Text"), new {@class="select" })
            </div>
        </div>
        <div class="form-row">
            <div class="col1">@Html.LabelFor(m => m.Users.IsZsl)</div>
            <div class="col2">
                YES: @Html.RadioButtonFor(m => m.Users.IsZsl, "True", new { title="ZSL User",@checked=true })
                NO: @Html.RadioButtonFor(m => m.Users.IsZsl, "False", new { title = "Other Domain User" })
            </div>
        </div>
        <div class="form-row">
            <div class="col1">@Html.LabelFor(m => m.Users.IsActive)</div>
            <div class="col2">
                YES: @Html.RadioButtonFor(m => m.Users.IsActive , "True", new { @checked=true })
                NO: @Html.RadioButtonFor(m => m.Users.IsActive, "False")
            </div>
        </div>
        <div class="form-buttons">
            <p>
                <button type="submit" class="save-button">
                    Save</button>
            </p>
        </div>
    </fieldset> 
}